package com.ruoyi.web.controller.system;


import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.ReportElement;
import com.ruoyi.system.service.IGenerateReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/system/report/generate")
@Api(tags = "报告：报告生成")
public class GenerateReportController {
    @Autowired
    private IGenerateReportService generateReportService;







    /**
     * 手动生成简报
     */
    @ApiOperation("手动生成简报")
    @PostMapping(value = "/generateReportByManual/{eventId}")
    public AjaxResult generateReportByManual(@PathVariable("eventId") Long eventId, @RequestBody List<ReportElement> elements) {
        return AjaxResult.success(generateReportService.generateReportByManual(eventId,elements));
    }






    /**
     * 获取首发媒体
     */
    @ApiOperation("获取首发媒体")
    @GetMapping(value = "/getStartingMedia/{eventId}")
    public AjaxResult getStartingMedia(@PathVariable("eventId") Long eventId) {
        return AjaxResult.success(generateReportService.getStartingMedia(eventId));
    }


    /**
     * 获取信息情感分布
     */
    @ApiOperation("获取信息情感分布")
    @GetMapping(value = "/getEmotionDistribution/{eventId}")
    public AjaxResult getEmotionDistribution(@PathVariable("eventId") Long eventId) {
        return AjaxResult.success(generateReportService.getEmotionDistribution(eventId));
    }


    /**
     * 获取信息趋势图
     */
    @ApiOperation("获取信息趋势图")
    @GetMapping(value = "/getInformationTrend/{eventId}")
    public AjaxResult getInformationTrend(@PathVariable("eventId") Long eventId) {
        return AjaxResult.success(generateReportService.getInformationTrend(eventId));
    }



    /**
     * 获取信息趋势图（阶段判断+预测）
     */
    @ApiOperation("获取信息趋势图（阶段判断+预测）")
    @GetMapping(value = "/getEventStage/{eventId}")
    public AjaxResult getEventStage(@PathVariable("eventId") Long eventId) {
        return AjaxResult.success(generateReportService.getEventStage(eventId));
    }



    /**
     * 获取媒体传播分析
     */
    @ApiOperation("获取媒体传播分析")
    @GetMapping(value = "/getMediaNameTrend/{eventId}")
    public AjaxResult getMediaNameTrend(@PathVariable("eventId") Long eventId,
                                        @RequestParam(value="timeType", required=false) String timeType,
                                        @RequestParam(value="beginPublishDay", required=false) String beginPublishDay,
                                        @RequestParam(value="endPublishDay", required=false) String endPublishDay
                                        ) {
        return AjaxResult.success(generateReportService.getMediaNameTrend(eventId,timeType,beginPublishDay,endPublishDay));
    }





    /**
     * 获取媒体名称分析
     */
    @ApiOperation("获取媒体名称分析")
    @GetMapping(value = "/getMediaNameAnalysis/{eventId}")
    public AjaxResult getMediaNameAnalysis(@PathVariable("eventId") Long eventId) {
        return AjaxResult.success(generateReportService.getMediaNameAnalysis(eventId));
    }

    /**
     * 获取媒体类型分析
     */
    @ApiOperation("获取媒体类型分析")
    @GetMapping(value = "/getMediaTypeAnalysis/{eventId}")
    public AjaxResult getMediaTypeAnalysis(@PathVariable("eventId") Long eventId) {
        return AjaxResult.success(generateReportService.getMediaTypeAnalysis(eventId));
    }




    /**
     * 获取本期导读信息
     */
    @ApiOperation("获取本期导读信息")
    @GetMapping(value = "/getBriefingGuide/{eventId}")
    public AjaxResult getBriefingGuide(@PathVariable("eventId") Long eventId) {
        return AjaxResult.success(generateReportService.getBriefingGuide(eventId));
    }

    /**
     * 获取处置建议
     */
    @ApiOperation("获取处置建议")
    @GetMapping(value = "/getSuggestions/{eventId}")
    public AjaxResult getSuggestions(@PathVariable("eventId") Long eventId) {
        return AjaxResult.success(generateReportService.getSuggestions(eventId));
    }



    /**
     * 获取监测概述
     */
    @ApiOperation("获取监测概述")
    @GetMapping(value = "/getMonitoringOverview/{eventId}")
    public AjaxResult getMonitoringOverview(@PathVariable("eventId") Long eventId) {
        return AjaxResult.success(generateReportService.getMonitoringOverview(eventId));
    }

    /**
     * 获取事件简介
     */
    @ApiOperation("获取事件简介")
    @GetMapping(value = "/getEventOverview/{eventId}")
    public AjaxResult getEventOverview(@PathVariable("eventId") Long eventId) {
        return AjaxResult.success(generateReportService.getEventOverview(eventId));
    }







}
